package cn.northsea.mapper;

import cn.northsea.pojo.Dept;

import cn.northsea.pojo.User;
import org.apache.ibatis.annotations.Delete;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DeptMapper {


    @Select("select * from erp_dept")
    List<Dept> findAll();

    @Select("select * from erp_user where user_id=#{value}")
    User findUserById(Integer userId);

    @Delete("delete from erp_user_dept where user_id = #{value}")
    void delDept(Integer userId);

    @Update("update erp_user set dept_id = #{deptId} where user_id = #{userId}")
    void allocationDept(@Param("userId") Integer userId,
                        @Param("deptId") Integer deptId);

}
